#ifndef YCBASESERVICEENVIRONMENT_H
#define YCBASESERVICEENVIRONMENT_H
#include <QHash>
#include <QString>

namespace yc {

class ServiceEnvironment
{
public:
    enum Type {
        ONLINE = 0,
        YZ,
        QA,
        TYPE_COUNT,
    };

    explicit ServiceEnvironment(Type type = ONLINE) : type_(type) { }

    Type type() const { return type_; }
    void setType(Type type) { type_ = type; }

    const QHash<QString, QString>& options() const { return options_; }
    void setOptions(const QHash<QString, QString>& options) { options_ = options; }

    QString optionValue(const QString& name, const QString& scope = QString()) const
    {
        const QString key = scope.isEmpty() ? name : QString("%1.%2").arg(scope, name);
        return options_.value(key);
    }
    void setOptionValue(const QString& name, const QString& value, const QString& scope = QString())
    {
        const QString key = scope.isEmpty() ? name : QString("%1.%2").arg(scope, name);
        options_.insert(key, value);
    }

private:
    Type type_;
    QHash<QString, QString> options_;
};
} // namespace yc

#endif // YCBASESERVICEENVIRONMENT_H
